<?php

$tabInterests = getInterests();
echo <<< EOPAGE
<section id="interests" class="content">
EOPAGE;
if (isset($tabInterests['interests']) && count($tabInterests['interests']) > 0) {
    echo <<< EOPAGE
		<script type="application/javascript">
			Fk.bind('load', function(){
				Fk.map.init(37.462841, -122.262053, google.maps.MapTypeId.ROADMAP, 7);
				Fk.map.displayTravelDest({$tabInterests['travels']});
			});
		</script>
EOPAGE;

    foreach ($tabInterests['interests'] as $category) {
        //creation de la liste
        $htmlList = "";
        foreach ($category["interests"] as $interest) {
            $htmlList .= '<li>';
            if ($interest->year() != null)
                $htmlList .= '<span class="year">' . $interest->year() . '</span>: ';
            $htmlList .= $interest->name();
            if ($interest->description() != null)
                $htmlList .= ' (' . $interest->description() . ')';
            $htmlList .='</li>';
        }
        // fin de la creation de la liste

        $categoryId = str_replace(' ', '_', $category['category']->name());
        switch ($category['category']->name()) {
            case 'Travel':
                echo <<< EOINTERESTS
<div id="$categoryId" class="interestsCategory">
	<h1>{$category['category']->name()}</h1>
	<ul class="floatLeft">
		$htmlList
	</ul>
	<div id="map_canvas" style="height:250px;"></div>
</div>
EOINTERESTS;
                break;
            /*case 'Sports':
                echo <<< EOINTERESTS
<div id="sportsMiscInterest">
	<div id="$categoryId" class="interestsCategory">
		<h1>{$category['category']->name()}</h1>
		<ul>
			$htmlList
		</ul>
	</div>
EOINTERESTS;
                break;
            case 'Miscellaneous':
                echo <<< EOINTERESTS
	<div id="$categoryId" class="interestsCategory">
		<h1>{$category['category']->name()}</h1>
		<ul>
			$htmlList
		</ul>
	</div>
</div>
EOINTERESTS;
                break;*/
            default:
                echo <<< EOINTERESTS
<div id="$categoryId" class="interestsCategory">
	<h1>{$category['category']->name()}</h1>
	<ul>
		$htmlList
	</ul>
</div>
EOINTERESTS;
                break;
        }
    }
}
else
    echo 'no interest';
echo '</section>';
?>